<html>
<head><meta charset="utf-8"><title>Windows paths · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Windows.20paths.html">Windows paths</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="225836530"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Windows%20paths/near/225836530" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> ivan770 <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Windows.20paths.html#225836530">(Feb 10 2021 at 13:40)</a>:</h4>
<p>Hi! Is there any pattern to determine if Windows drive letter has to be lower-cased or upper-cased? Kinda stuck with <a href="https://github.com/rust-analyzer/rust-analyzer/pull/7596">https://github.com/rust-analyzer/rust-analyzer/pull/7596</a>, because of failing Windows build <span aria-label="upside down" class="emoji emoji-1f643" role="img" title="upside down">:upside_down:</span></p>



<a name="225836786"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Windows%20paths/near/225836786" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> ivan770 <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Windows.20paths.html#225836786">(Feb 10 2021 at 13:42)</a>:</h4>
<p>I think main trouble for understanding is that <a href="https://github.com/rust-analyzer/rust-analyzer/pull/7596/checks?check_run_id=1871366255#step:9:2450">https://github.com/rust-analyzer/rust-analyzer/pull/7596/checks?check_run_id=1871366255#step:9:2450</a> and <a href="https://github.com/rust-analyzer/rust-analyzer/pull/7596/checks?check_run_id=1871366255#step:9:2457">https://github.com/rust-analyzer/rust-analyzer/pull/7596/checks?check_run_id=1871366255#step:9:2457</a> have different drive letters, even though they are in the same response.</p>



<a name="225836848"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Windows%20paths/near/225836848" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Windows.20paths.html#225836848">(Feb 10 2021 at 13:42)</a>:</h4>
<p>Hm</p>



<a name="225837029"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Windows%20paths/near/225837029" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Windows.20paths.html#225837029">(Feb 10 2021 at 13:44)</a>:</h4>
<p>I think this is more complicated that that, sadly. The problem is, there isn't an easy way to write tests at this layer of abstraction. But that should be OK, because this layer of abstraction should be relatively dumb.</p>



<a name="225837197"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Windows%20paths/near/225837197" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Windows.20paths.html#225837197">(Feb 10 2021 at 13:45)</a>:</h4>
<p>That is, the problem is that the code we want to test lives in the place where testing is awkward. We can do one of the two:</p>
<ul>
<li>merge the code as is, without tests, and I'll refactor it to be more testable</li>
<li>I can write some mentoring instructions for the refactor I have in mind</li>
</ul>



<a name="225837359"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Windows%20paths/near/225837359" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> ivan770 <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Windows.20paths.html#225837359">(Feb 10 2021 at 13:47)</a>:</h4>
<p>I'm not sure if we really need to remove those tests, since they are testing Linux/Mac at the very least</p>



<a name="225837541"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Windows%20paths/near/225837541" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Windows.20paths.html#225837541">(Feb 10 2021 at 13:48)</a>:</h4>
<p>That's the problem exactly: there's no reason why reference code lens need to have anything to do with  mac vs linux.</p>



<a name="225837591"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Windows%20paths/near/225837591" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Windows.20paths.html#225837591">(Feb 10 2021 at 13:48)</a>:</h4>
<p>the very fact that we observe the diff means that we are testing the wrong thing here.</p>



<a name="225837774"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Windows%20paths/near/225837774" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> ivan770 <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Windows.20paths.html#225837774">(Feb 10 2021 at 13:50)</a>:</h4>
<p>Oh, got it</p>



<a name="225838025"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Windows%20paths/near/225838025" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Windows.20paths.html#225838025">(Feb 10 2021 at 13:52)</a>:</h4>
<p>Roughly, everything there is in <code>handle_code_lens</code> should be a method of <code>Analysis</code> instead</p>



<a name="225838135"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Windows%20paths/near/225838135" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Windows.20paths.html#225838135">(Feb 10 2021 at 13:53)</a>:</h4>
<p>and <code>handle_</code> should just convert that to LSP, instead of containing actual logic, like </p>
<div class="codehilite"><pre><span></span><code>matches!(
                    it.kind,
                    SymbolKind::Trait | SymbolKind::Struct | SymbolKind::Enum | SymbolKind::Union
                )
</code></pre></div>



<a name="225840249"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Windows%20paths/near/225840249" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Windows.20paths.html#225840249">(Feb 10 2021 at 14:09)</a>:</h4>
<p>So, I imagine we want API like the following in ide/lib.rs</p>
<div class="codehilite"><pre><span></span><code>pub struct Annotation {
    range: TextRange,
    annotation_kind: AnnotationKind
}
pub enum AnnotationKind {
    Runnable,
    HasImpls,
    HasReferences,
}

impl Analysis {
    pub fn annotations(&amp;self, file_id: FileId) -&gt; Cancelable&lt;Annotation&gt; {
    }

    pub fn resolve_annotation(&amp;self, file_id: FileId) -&gt; Cancelable&lt;Option&lt;ResolvedAnnotation&gt;&gt; {
    }
}
</code></pre></div>



<a name="225840463"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Windows%20paths/near/225840463" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Windows.20paths.html#225840463">(Feb 10 2021 at 14:10)</a>:</h4>
<p>Than, handle_code_lens and handle_code_lens_resolve are implemented in terms of thes methonds of analysis.</p>



<a name="225845252"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Windows%20paths/near/225845252" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> ivan770 <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Windows.20paths.html#225845252">(Feb 10 2021 at 14:40)</a>:</h4>
<p>Hmm. Would it be actually better, if we accepted <code>Annotation</code> in <code>resolve_annotation</code>, just as LSP sends resolve request per every unresolved CodeLens?</p>



<a name="225845762"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Windows%20paths/near/225845762" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Windows.20paths.html#225845762">(Feb 10 2021 at 14:43)</a>:</h4>
<p>right, it should be <code>resolve_annotation(&amp;self, file_id: FileId, annotation: Annotation)</code>, that is typo</p>



<a name="225846177"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Windows%20paths/near/225846177" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Windows.20paths.html#225846177">(Feb 10 2021 at 14:46)</a>:</h4>
<p>If you'd like to fix that, please read <a href="https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/dev/architecture.md#crateside">https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/dev/architecture.md#crateside</a> and <a href="https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/dev/architecture.md#cratesrust-analyzer">https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/dev/architecture.md#cratesrust-analyzer</a> sections of architecture md, they describe the reasons why the API needs to be structured that way</p>



<a name="225846223"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Windows%20paths/near/225846223" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> ivan770 <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Windows.20paths.html#225846223">(Feb 10 2021 at 14:46)</a>:</h4>
<p>Thanks! I'll take a look at it.</p>



<a name="225846299"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Windows%20paths/near/225846299" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Windows.20paths.html#225846299">(Feb 10 2021 at 14:47)</a>:</h4>
<p>Sorry for not noticing the impending yak shave from the start!</p>



<a name="226126216"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Windows%20paths/near/226126216" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> ivan770 <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Windows.20paths.html#226126216">(Feb 12 2021 at 11:41)</a>:</h4>
<p>Almost done. Howerer, I still have <em>lots</em> of questions about RA architecture (mostly about where to put a function or a struct). For example, I added an <code>annotation</code> function to <code>to_proto</code> crate, and it depends on those two functions <a href="https://github.com/rust-analyzer/rust-analyzer/blob/de046bf4572a75cf534a2342358a422b2f18d01c/crates/rust-analyzer/src/handlers.rs#L1533-L1547">https://github.com/rust-analyzer/rust-analyzer/blob/de046bf4572a75cf534a2342358a422b2f18d01c/crates/rust-analyzer/src/handlers.rs#L1533-L1547</a>. Where should I put both of these functions, so they would be available for <a href="https://github.com/rust-analyzer/rust-analyzer/blob/de046bf4572a75cf534a2342358a422b2f18d01c/crates/rust-analyzer/src/handlers.rs#L1621">https://github.com/rust-analyzer/rust-analyzer/blob/de046bf4572a75cf534a2342358a422b2f18d01c/crates/rust-analyzer/src/handlers.rs#L1621</a> and other possible components?</p>



<a name="226134919"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Windows%20paths/near/226134919" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> ivan770 <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Windows.20paths.html#226134919">(Feb 12 2021 at 13:15)</a>:</h4>
<p>Moving to <code>ide</code> part is ready: <a href="https://github.com/rust-analyzer/rust-analyzer/pull/7596">https://github.com/rust-analyzer/rust-analyzer/pull/7596</a></p>



<a name="226158522"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Windows%20paths/near/226158522" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Windows.20paths.html#226158522">(Feb 12 2021 at 16:18)</a>:</h4>
<p><code>show_references_command</code> and friends return an <code>lsp_types::Command</code>, so  <code>to_proto</code> feels like an appropriate place</p>



<a name="226158575"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Windows%20paths/near/226158575" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Windows.20paths.html#226158575">(Feb 12 2021 at 16:19)</a>:</h4>
<p><code>to_proto::command::show_references</code> even.</p>



<a name="226158815"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Windows%20paths/near/226158815" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Windows.20paths.html#226158815">(Feb 12 2021 at 16:21)</a>:</h4>
<p>So, the helpers which return titles may live there as well.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>